﻿Public Class DanhSachKhoHang_DAO

    Public Shared Function SelectAll() As DataTable
        Dim dt As DataTable
        Dim strSQL As String = "select * from KhoHang"
        dt = SQLProvider.ExecQuery(strSQL)
        Return dt
    End Function

    Public Shared Sub Insert(_kh As DanhSachKhoHang_DTO)
        Dim strSQL As String = "Insert into KhoHang(MaKho,TenKho,DiaChi) values('" & _kh.MaKho & "','" & _kh.TenKho & "','" & _kh.DiaChi & "')"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub

    Public Shared Sub Delete(_kh As DanhSachKhoHang_DTO)
        Dim strSQL As String = "Delete from KhoHang where MaKho='" & _kh.MaKho & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub

    Public Shared Sub Update(_kh As DanhSachKhoHang_DTO)
        Dim strSQL As String = "Update KhoHang set MaKho ='" & _kh.MaKho & "' ,TenKho='" & _kh.TenKho & "' ,DiaChi='" & _kh.DiaChi & "' where MaKho = '" & _kh.MaKho & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
   
End Class
